package com.niuke;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class NiuKe2 {

    public static void main(String[] args) {
        Scanner sc1 = new Scanner(System.in);
        String str1 = sc1.nextLine();
        String str2 = sc1.nextLine();
        System.out.println(getAns(str1, str2));
    }

    public static String getAns(String str1, String str2) {
        Set<Character> set = new HashSet<>();
        for (int j = 0; j < str2.length(); j++) {
            set.add(str2.charAt(j));
        }
        int str2Count = set.size();

        char[] c = str1.toCharArray();
        int idx = str2Count;
        String res = "Not Found";
        String str = "";
        for (int i = 0; i < c.length; i++) {
            boolean isNum = (c[i] - '0') >= 0 && (c[i] - '9') <= 0;
            boolean isAF = (c[i] - 'a') >= 0 && (c[i] - 'f') <= 0;
            if (isNum || isAF) {
                if (!"".equals(str)) {
                    Set<Character> set1 = new HashSet<>();
                    for (int j = 0; j < str.length(); j++) {
                        set1.add(str.charAt(j));
                    }
                    int newIdx = str2Count - set1.size();
                    if (set1.size() <= str2Count && newIdx <= idx) {
                        res = str;
                        idx = newIdx;
                    }
                }
                str = "";
            } else {
                str += Character.toString(c[i]);
            }
        }
        if (!"".equals(str)) {
            Set<Character> set1 = new HashSet<>();
            for (int j = 0; j < str.length(); j++) {
                set1.add(str.charAt(j));
            }
            int newIdx = str2Count - set1.size();
            if (set1.size() <= str2Count && newIdx <= idx) {
                res = str;
                idx = newIdx;
            }
        }

        return res;
    }

}
